<extend name="Public/base"/>
<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>

    <form action="" method="post" class="form-horizontal">
        <!--  标题  -->
        <div class="form-item">
            <label class="item-label">标题</label>
            <div class="controls">
                <input type="text" class="text input-large" name="title" value="{$info.title}">
            </div>
        </div>

        <!--  封面图  -->
        <div class="controls">
            <label class="item-label">封面图<span class="check-tips">（推荐尺寸：240px * 160px）</span></label>
            <input type="file" id="img_file" style="display: none">
            <input type="hidden" name="img" id="img" value="{$info['img']|default=''}"/>
            <img class="upload-file" src="{$info.img|getPicture}" id="uploadImg">
            <script type="text/javascript">
                $("#uploadImg").click(function (){
                    $("#img_file").trigger("click");
                })
                $('#img_file').change(function (){
                    var pic = $(this)[0].files[0];
                    var formData = new FormData();
                    var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                    formData.append('download', pic);
                    $.ajax({
                        url:url,
                        type:"post",
                        data: formData,
                        cache: false,
                        contentType: false,
                        processData: false,
                        success:function(data){
                            if(data.status == 1){
                                //上传成功
                                var id = data.id;
                                var path = data.path;

                                $('#img').val(id);
                                $('#uploadImg').attr('src', path);
                            }else{
                                layer.msg(data.info);
                            }
                        }
                    });
                });
            </script>
        </div>

        <!--  分类  -->
        <div class="form-item">
            <label class="item-label">分类</label>
            <div class="controls">
                <select name="type_id">
                    <option value="0">请选择分类</option>
                    <volist name="type_list" id="vo">
                        <option value="{$vo.id}" <if condition="$vo['id'] eq $info['type_id']">selected</if>>{$vo.name}</option>
                    </volist>
                </select>
            </div>
        </div>
        <!--  来源  -->
        <div class="form-item">
            <label class="item-label">来源</label>
            <div class="controls">
                <input type="text" class="text input-large" name="from" value="{$info.from}">
            </div>
        </div>
        <!--  内容  -->
        <div class="form-item">
            <label class="item-label">内容</label>
            <div class="controls">
                <label class="textarea input-large" style="width: 1250px;">
                    <textarea name="content">{$info.content}</textarea>
                    {:hook("adminArticleEdit", array("name"=>content,"value"=>$info["content"]))}
                </label>
            </div>
        </div>

        <input type="hidden" value="{:I('id')}" name="id" />
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U("Manage/informationList")}');
    </script>
</block>
</html>